New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify NSModel to use boost variant. #693
Modify NSModel to use boost variant. #693
Conversation
0429c95
to
5290e37
Compare
5290e37
to
86a9852
Compare
@@ -13,12 +13,24 @@ | |||
#include <mlpack/core/tree/binary_space_tree.hpp> | |||
#include <mlpack/core/tree/cover_tree.hpp> | |||
#include <mlpack/core/tree/rectangle_tree.hpp> | |||
|
|||
#include <boost/variant.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add 'variant' to the list of Boost libraries we require in the documentation and in the root CMakeLists.txt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a header only library, so we don't need to include it in CMakeList.txt.
I can see that all boost dependencies mentioned in the README file: program_options, math_c99, unit_test_framework, and serialization, are not header only. Should I include variant there anyway? even if it is header only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it is header only. I am not sure if it is possible to have a Boost installation where some of the header-only libraries (but not all) are available; I haven't played with b2 (Boost's build system) enough recently to be sure. If it's possible to have a Boost installation with some of the header-only libraries omitted, then we should include variant
in there; otherwise, I don't think it's necessary. But I'm not sure whether or not that's possible...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a quick search, it looks like there is no such option to omit some header files...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, looks like there is nothing special we need to do with our CMake configuration for this change then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we don't have to add boost::variant to required libraries?? Even if its header only we need to make sure the headers are present. Or is it the part of basic boost which is included in every boost package?? I mean if I install just boost::math in ubuntu with apt-get do I get boost::variant??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see a note about this in boost's documentation: [ref]
"Other Packages
RedHat, Debian, and other distribution packagers supply Boost library packages, however you may need to adapt these instructions if you use third-party packages, because their creators usually choose to break Boost up into several packages, reorganize the directory structure of the Boost distribution, and/or rename the library binaries. If you have any trouble, we suggest using an official Boost distribution from SourceForge. "
I am not sure. But it looks like all partial packages depends on libboost-dev package, so they will finally include all headers files.
For example: libboost-program-options-dev --depends on--> libbooost-dev
The problem with appveyor is similar to this one: #476
@rcurtin @stereomatchingkiss Any suggestion? |
arma::mat& distances); | ||
}; | ||
|
||
class SearchVisitor : public boost::static_visitor<void> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should change the name of this class and SearchKVisitor
to BichromaticSearchVisitor
and MonochromaticSearchVisitor
, respectively, for clarity? I couldn't think of any shorter names to differentiate there, but maybe you have a better idea? The root of my concern is that Search
and SearchK
don't really describe the difference in what is going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I agree. I will change this.
1b87667
to
a0bcee9
Compare
Hi, Marcos, I found a way to mimic alias template, please check the codes at pastebin. |
…rainVisitor. Also, add a more specific definition of NSTypeT, to avoid vc compiler errors.
@stereomatchingkiss thanks!! I am considering that option. |
@stereomatchingkiss AppVeyor succeeded! I have made it a little different to avoid code bloat. |
I think this is ready to be merged. Please let me know if you want me to improve something. |
@@ -37,6 +49,127 @@ struct NSModelName<FurthestNeighborSort> | |||
static const std::string Name() { return "furthest_neighbor_search_model"; } | |||
}; | |||
|
|||
class MonoSearchVisitor : public boost::static_visitor<void> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I hate to be picky, so I hope I am not giving too much work, but do you think you could add documentation for these classes and their members and member functions? I am not sure everyone who looks through this file will be familiar with the visitor paradigm; there is no need to explain what that is in your comments, but it may be useful to have comments along the lines of "MonoSearchVisitor executes a monochromatic neighbor search on the given NSType", or something like this. Maybe a few more words are useful to explain that better. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I should add, if you don't want to or are busy doing other things, I can do the documentation here, it will only take a few minutes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rcurtin Sure!! I am here for this! I agree it can be confusing for someone with no knowledge of boost variants. I will add documentation.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in: 6c2c3ca
931e753
to
b34dac8
Compare
Hi, in b34dac8 , I fixed serialization of NSModel. Loading was not working before that commit. |
Everything looks good to me; @sumedhghaisas, I have no more comments, so feel free to merge when you are happy. :) |
No description provided.